/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package marcin.belzowski.geoMap;

import com.vividsolutions.jts.geom.Point;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.Type;

/**
 *
 * @author marcin
 */
@Entity
@Table(name = "position")
@NamedQueries({@NamedQuery(name = "Position.findAll", query = "SELECT p FROM Position p"), @NamedQuery(name = "Position.findById", query = "SELECT p FROM Position p WHERE p.id = :id"), @NamedQuery(name = "Position.findByDatesent", query = "SELECT p FROM Position p WHERE p.datesent = :datesent")})
public class Position implements Serializable {
    private static final long serialVersionUID = 1L;
   @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Column(name = "datesent")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datesent;
   
    @Column(name = "the_geom")
     @Type(type = "org.hibernatespatial.GeometryUserType")
    private Point point;

    public Position() {
    }

    public Position(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Date getDatesent() {
        return datesent;
    }

    public void setDatesent(Date datesent) {
        this.datesent = datesent;
    }

    public Point getPoint() {
        return this.point;
    }

    public void setPoint(Point theGeom) {
        this.point = theGeom;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Position)) {
            return false;
        }
        Position other = (Position) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "marcin.belzowski.geoMap.Position[id=" + id + "]";
    }

}
